﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MusicPlayerPlus
{
    public class PlugIn
    {
        Core.AddPlugIn addPlugIn = new Core.AddPlugIn();
        /// <summary>
        /// 搜索插件路径
        /// </summary>
        /// <returns></returns>
        private List<string> FindPlugInPath()
        {
            string folder = "";
            List<string> fileList = new List<string>();
            folder = AMing.Core.IO.Path.GetApplicationPath(folder);

            string[] files = System.IO.Directory.GetFiles(folder, "MusicPlayerPlus.PlugIn.*.dll");
            fileList.AddRange(files);

            return fileList;
        }

        /// <summary>
        /// 初始化插件
        /// </summary>
        /// <param name="dllpath"></param>
        /// <param name="actionParamData"></param>
        public void InitPlugIn()
        {
            List<string> filelist = FindPlugInPath();
            foreach (var item in filelist)
            {
                addPlugIn.Instantiation(item);
            }
            addPlugIn.AutoExecute();
        }

    }
}
